<?php
/**
 * Entry point for communities applications
 *
 * @copyright Anuradha Fernando
 * @license Please, don't read or copy
 *
 * @author LionParadise
 *
 * @version 1.0
 * @package Communities
 *
 */
error_reporting(0);
header("Cache-Control: no-cache, must-revalidate");
header("Expires: Mon, 26 Jul 2997 05:00:00 GMT");
ini_set('display_errors',true); // set this to 0 on live version
date_default_timezone_set('Europe/Brussels');

set_include_path('.' . PATH_SEPARATOR . '../library' .
PATH_SEPARATOR . get_include_path());

include('Zend/Loader.php');
include('Zend/Loader/Autoloader.php');
require_once ('Zend/Json.php');

$autoloader = Zend_Loader_Autoloader::getInstance();
$autoloader->registerNamespace('AML_');
Zend_Session::start();

$staging = 'dev';

$config = new Zend_Config_Ini('../application/configs/db_config.ini', $staging);
$registry = Zend_Registry::getInstance();
$db = Zend_Db::factory($config->db);
$registry->set('config',$config);
$registry->set('db',$db);

Zend_Db_Table::setDefaultAdapter($db);

$view = new Zend_View;
$registry->set('view',$view);
//$form = new Zend_Form();
//$form->addPrefixPath('AML_Form_Element', '../library/Lion/Form/Element/', 'element');


$view->addHelperPath('../library/View/Helper','AML_View_Helper');
$view->addHelperPath('../library/ZendX/JQuery/View/Helper','ZendX_JQuery_View_Helper');
$view->addHelperPath('../library/Aml/Controller/Helper','Aml_Controller_Helper');
$viewRenderer = new Zend_Controller_Action_Helper_ViewRenderer($view);
Zend_Controller_Action_HelperBroker::addHelper($viewRenderer);

$layout = array(
            'layout'     => 'layout',
            'layoutPath' => $config->resources->layout->layoutPath
);

Zend_Layout::startMvc($layout);

$options = array();

$frontcontroller = Zend_Controller_Front::getInstance();
$frontcontroller->throwExceptions(true);
$frontcontroller->setControllerDirectory(array(
	'default'	=>	'../application/default/controllers',	
	'admin'	=>	'../application/admin/controllers'	
));

require '../library/Aml/Controller/Helper/Acl.php';
require '../library/Aml/Controller/Plugin/Acl.php';
$helper= new Aml_Controller_Helper_Acl();
$helper->setRoles();
$helper->setResources();
$helper->setPrivilages();
$helper->setAcl();
$frontcontroller->registerPlugin(new Aml_Controller_Plugin_Acl());


 

$frontcontroller->dispatch();
